package hate.util;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.Calendar;
import java.util.Date;

/**
 * 日期转换类
 */
public class DateUtil {


    public long Date2Long(Date date){
        date.getTime();
        return System.currentTimeMillis();
    }

    /**
     * 2019/06/16
     * @return
     */
    public static String getTimePath(){
        Calendar calendar = Calendar.getInstance();
        String year= String.valueOf(calendar.get(Calendar.YEAR));
        String mon=String.valueOf(calendar.get(Calendar.MONTH)+1);
        String date=String.valueOf(calendar.get(Calendar.DATE));

        System.out.println(calendar.get(Calendar.YEAR));
        System.out.println(calendar.get(Calendar.MONTH)+1);
        System.out.println(calendar.get(Calendar.DATE));
        return year+"/"+mon+"/"+date+"/";
    }

    public static void main(String[] ar) throws FileNotFoundException {
        File f = new File("C:/upFiles/aa.txt");
        if (!f.exists()) {
            FileOutputStream out = new FileOutputStream(f);
           // out.write(f.getBytes());
            //out.close();
        }
        System.out.println(getTimePath());

    }
}
